#define  _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    bool backspaceCompare(string s, string t) {
        return changeStr(s) == changeStr(t);
    }
    string changeStr(string s)
    {
        string ret;
        for (auto ch : s)
        {
            if (ch == '#')
            {
                if (!ret.empty()) ret.pop_back();
            }
            else ret += ch;
        }
        cout << ret;
        return ret;
    }
};